import { useNavigate, useParams, useSearchParams } from "react-router-dom"

export const useDetails = () => {
  const { id } = useParams()
  const [searchParams, _] = useSearchParams()
  const type = searchParams.get('type')
  const navigate = useNavigate()
  const onClose = () => {
    navigate(-1)
  }
  return {
    id,
    type,
    onClose
  }
}